package cn.wongshu.student.controller;

import cn.wongshu.student.data.StudentListData;
import cn.wongshu.student.pojo.Student;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentListData  studentListData;

    @GetMapping("")
    private List<Student> findAll(){
        return  studentListData.findAll();

    }


    @PostMapping("/deleteByIds")
    private Boolean deleteByIds(@RequestBody  Integer[] ids){
        if (ids != null && ids.length > 0){
            studentListData.delete(ids);
            return true;
        }
        return false;


    }

    @GetMapping("/new")
    private void getNewData(){

        studentListData.newStart();
    }




}
